@extends('layouts.tankuang')

@section('content')
    <form name="add_form" id="add_form" action="{{url('admin/units/add_baowei',$id)}}" method="post" enctype="multipart/form-data">
        <input type="hidden" name="_token" value="{{ csrf_token() }}">
        <div>
            <h2 class="text-center mg_b36 mg_t25" style="font-weight: bold;">
                {{getValue($type,'unit_type','id','name')}}安全检查
            </h2>
            <input type="hidden" name="_token" value="{{ csrf_token() }}">
            <table class="table-form table-border w mg-auto">
                {{--<tr>
                    <td class="font-bd">检查人</td>
                    <td colspan="2">
                        <input type="text" class="form-input" value="{{getValue(auth::user()->id,'admin_users','id','name')}}" name="" readonly>
                    </td>
                </tr>

                <tr>
                    <td class="font-bd">检查时间</td>
                    <td colspan="2">
                        <input class="easyui-datebox w153" value="" name="add_time">
                    </td>
                </tr>

                <tr>
                    <td class="font-bd">单位负责人</td>
                    <td colspan="2">
                        <input type="text" class="form-input" value="{{$re->frdb_name}}" name="fuzeren_name">
                    </td>
                </tr>

                <tr>
                    <td class="font-bd">负责人电话</td>
                    <td colspan="2">
                        <input type="text" class="form-input" value="{{$re->frdb_phone}}" name="fuzeren_phone">
                    </td>
                </tr>--}}

                @foreach($aqjc as $v)
                    <tr>
                        <td class="font-bd" width="70%">{{$v->field_content}}</td>
                        <td width="30%">
                            @if($v->field_type == 1)
                                <input type="radio" value="是" name="aqjc[{{$v->field_name}}]">是
                                <input type="radio" value="否" name="aqjc[{{$v->field_name}}]">否
                            @elseif($v->field_type == 2)
                                @foreach($v->daan as $v2)
                                    <input type="radio" value="{{$v2->val}}" name="aqjc[{{$v->field_name}}]">{{$v2->val}}
                                @endforeach
                            @endif
                        </td>
                    </tr>
                @endforeach

                <tr>
                    <td class="font-bd">备注</td>
                    <td colspan="2">
                        <textarea class="textarea" name="remark"></textarea>
                    </td>
                </tr>

                <tr>
                    <td class="font-bd">是否合格</td>
                    <td>
                        <input type="radio" value="1" name="status">合格
                        <input type="radio" value="2" name="status">不合格
                    </td>
                </tr>
            </table>

            <div class="w wbt mg_t25 text-center">
                <button id="go" type="button" class="easyui-linkbutton dsp font-bd" data-options="iconCls:'icon-save'">确定</button>
                <button type="button" class="easyui-linkbutton dsp" data-options="iconCls:'icon-no'" onclick="$('#tk').window('close')">关闭</button>
            </div>
        </div>
    </form>

    <script>
        $('#go').click(function (){
            $.ajax({
                cache: true,
                type: "POST",
                url: "{{url('admin/jiancha/add_jiancha',$id)}}",
                data:$('#add_form').serialize(),
                async: false,
                success: function(data) {
                    if(data.status == 1){
                        $.messager.alert('信息提示',data.msg,'info');
                        $('#tk').dialog('close');
                        $('.pagination-load').click();
                    }else{
                        $.messager.alert('信息提示',data.msg,'info');
                    }
                }
            });
        });
    </script>
@stop